var Form2: TForm2; x,y,npo1,zo1:Integer; s1,s2,s3,s4,s5:string; implementation {$R *.dfm} procedure TForm2.vvvo; begin if npo1=1 then begin Image1.Picture.LoadFromFile('p1.bmp');Image2.Picture.LoadFromFile('n1.bmp'); Image3.Picture.LoadFromFile('n2.bmp');Image4.Picture.LoadFromFile('n3.bmp'); end; if npo1=2 then begin Image1.Picture.LoadFromFile('n1.bmp');Image2.Picture.LoadFromFile('p1.bmp'); Image3.Picture.LoadFromFile('n3.bmp');Image4.Picture.LoadFromFile('n2.bmp'); end; if npo1=3 then begin Image1.Picture.LoadFromFile('n1.bmp');Image2.Picture.LoadFromFile('n2.bmp'); Image3.Picture.LoadFromFile('p1.bmp');Image4.Picture.LoadFromFile('n3.bmp'); end; if npo1=4 then begin Image1.Picture.LoadFromFile('n3.bmp');Image2.Picture.LoadFromFile('n2.bmp'); Image3.Picture.LoadFromFile('n1.bmp');Image4.Picture.LoadFromFile('p1.bmp'); end; end; procedure TForm2.Button1Click(Sender: TObject); begin close; end; procedure TForm2.Button2Click(Sender: TObject); begin ComboBox1.Visible:=True; with Form2.Canvas, Font do begin x:=100;y:=50; Brush.Color:=clbtnface; size:=26; name:='Monotype Corsiva'; Style:=[fsBold]; textout(x,y,'На якому з рисунків зображено графік функції:'); textout(x+300,y+40,'у= -х +2'); TextOut(x-100,y+100,'A)');TextOut(x+120,y+100,'Б)'); TextOut(x+340,y+100,'В)');TextOut(x+560,y+100,'Г)'); size:=12; TextOut(x+375,y+40,'2'); npo1:=Random(39)+10;npo1:=Trunc(npo1/10); vvvo; end; end; procedure TForm2.FormCreate(Sender: TObject); begin Randomize; Label1.Caption:=''; ComboBox1.Visible:=false; end; procedure TForm2.Button3Click(Sender: TObject); begin zo1:=combobox1.ItemIndex; Str(npo1,s1); if zo1+1=npo1 then Label1.Caption:='Правильно' else begin Label1.Caption:='Неправильно'; combobox1.Color:=clred; end; combobox1.Enabled:=false; end; end. procedure TForm2.vvvo;
begin
if npo1=1 then begin Image1.Picture.LoadFromFile('p1.bmp');Image2.Picture.LoadFromFile('n1.bmp'); Image3.Picture.LoadFromFile('n2.bmp');Image4.Picture.LoadFromFile('n3.bmp'); end;
if npo1=2 then begin Image1.Picture.LoadFromFile('n1.bmp');Image2.Picture.LoadFromFile('p1.bmp'); Image3.Picture.LoadFromFile('n3.bmp');Image4.Picture.LoadFromFile('n2.bmp'); end;
if npo1=3 then begin Image1.Picture.LoadFromFile('n1.bmp');Image2.Picture.LoadFromFile('n2.bmp'); Image3.Picture.LoadFromFile('p1.bmp');Image4.Picture.LoadFromFile('n3.bmp'); end;
if npo1=4 then begin Image1.Picture.LoadFromFile('n3.bmp');Image2.Picture.LoadFromFile('n2.bmp'); Image3.Picture.LoadFromFile('n1.bmp');Image4.Picture.LoadFromFile('p1.bmp'); end;
Секція var:
var
Form2: TForm2;
x,y,npo1,zo1:Integer;
s1,s2,s3,s4,s5:string;